import { get, post, put, del, upload } from '@/utils/request'

const VERSION = '/v1'

export default {
  // 获取标签
  getTag: params => get(VERSION, '/media/tag/list', params),
  getTagTree: params => get(VERSION, '/terminal/common/tree', params),
  // 媒体管理相关
  get: params => get(VERSION, '/media/page', params),
  getAuditPage: params => get(VERSION, '/media/audit/page', params),
  mediaAudit: params => put(VERSION, '/media/audit/audit', params),
  mediaUrgent: params => get(VERSION, '/media/urgent/page', params),
  mediaAuditUrgent: params => put(VERSION, '/media/urgent/audit', params),
  getInfo: params => get(VERSION, '/media/info', params),
  getLocalInfo: params => get(VERSION, '/preview/textPreview', params),
  del: params => del(VERSION, '/media', params),
  modify: params => put(VERSION, '/media', params),
  modifyFolder: params => put(VERSION, '/media/modifyFolderMedia', params),
  save: params => post(VERSION, '/media/save', params),
  saveText: params => post(VERSION, '/media/saveText', params),
  saveDvb: params => post(VERSION, '/media/saveDvb', params),
  saveFolder: params => post(VERSION, '/media/saveFolder', params),
  saveQRCode: params => post(VERSION, '/media/QRCode', params),
  upload: (params, progressCb, cancelToken) => upload(VERSION, '/media/uploading', params, progressCb, cancelToken),
  // mediaList: params => get(VERSION, '/media/list', params),
  getWebImg: params => get(VERSION, '/media/webImage', params),
  // 目录管理相关
  getCatalogue: params => get(VERSION, '/folder/list', params),
  saveCatalogue: params => post(VERSION, '/folder', params),
  updateCatalogue: params => put(VERSION, '/folder', params),
  delCatalogue: params => del(VERSION, '/folder', params),
  getFollow: params => get(VERSION, '/folder/followmedial', params),
  // getPubCatalogue: () => get(VERSION, '/terminal/group/list/screen', {}), // 节目发布目录树
  getPubCatalogue: params => get(VERSION, '/terminal/common/group/list/screen', {screenType:2}),
  getOtherMedia: params => get(VERSION, '/folder/othermedia', params),
  // 节目制作相关
  getProgramInfo: params => get(VERSION, '/program', params),
  getProgram: params => get(VERSION, '/program/page', params),
  saveProgram: params => post(VERSION, '/program', params),
  saveAsProgram: params => post(VERSION, '/program/save/as', params),
  updateProgram: params => put(VERSION, '/program', params),
  delProgram: params => del(VERSION, '/program', params),
  auditProgram: params => put(VERSION, '/program/audit', params),
  previewProgram: params => put(VERSION, '/program/preview', params),
  getProgramAround: params => get(VERSION, '/around/page', params),
  // 节目发布相关
  getPubList: params => post(VERSION, '/schedule/page', params),
  delPubList: params => del(VERSION, '/schedule', params),
  removePubList: params => del(VERSION, '/schedule/removeProgram', params),
  revokePubList: params => del(VERSION, '/schedule/revoke', params),
  auditPubList: params => put(VERSION, '/schedule/audit', params),
  addPubList: params => post(VERSION, '/schedule', params),
  editPubList: params => put(VERSION, '/schedule', params),
  getPubProgramList: id => get(VERSION, '/schedule', {id}),
  getPubMediaListt:params=> get(VERSION,'/media/preview',params),
  getPubProgramExportList: params => get(VERSION, '/schedule/exportPageByIds', params),
  exportProgramFile:  (params, progressCb, cancelToken) => upload(VERSION, '/schedule/import',  params, progressCb, cancelToken),

  // 模板管理相关
  loadTemplate: params => get(VERSION, '/template/page', params),
  // 根据ID查询模板
  loadTemplateById: params => get(VERSION, '/template', params),
  // 添加模板
  saveTemplate: params => post(VERSION, '/template', params),
  // 修改模板
  editTemplate: params => put(VERSION, '/template', params),
  // 查询模板
  getTemplate: params => get(VERSION, '/template/page', params),
  // 删除模板
  deleteTemplate: params => del(VERSION, '/template', params),
  // 审核模板
  examineTemplate: params => put(VERSION, '/template/audit', params),
  // 选择背景图片
  loadBackgroudImg: params => get(VERSION, '/media/backgroundImage', params),


  // 返回节目播放xml数据
  getScheduleXml:  params => get(VERSION, '/program/xml', params),

  // 媒体按月播放统计
  getMediaPlayStatisties:  params => get(VERSION, '/cockpit/months', params),
  // 媒体播放排行统计
  getMediaTops:  params => get(VERSION, '/cockpit/tops', params),
  // 媒体类型统计
  getMediaTypes:  params => get(VERSION, '/cockpit/types', params)
}
